<?php
class model_post extends lib_db_model {
	/**
	 * model 对应的 table
	 */
	public $_table='posts';
	
	public $_field=array(
		'id'=>array(
			'$fieldName'=>'id'
		),
		'author'=>array(-
			'$fieldName'=>'author'
		),
		'date'=>array(-
			'$fieldName'=>'date'
		),
		'title'=>array(
			'$fieldName'=>'title'
		),
		'content'=>array(
			'$fieldName'=>'content'
		),
		'excerpt'=>array(
			'$fieldName'=>'excerpt'
		),
		'status'=>array(
			'$fieldName'=>'status'
		),
		'password'=>array(
			'$fieldName'=>'password'
		),
		'modified'=>array(
			'$fieldName'=>'modified'
		),
		'parent'=>array(
			'$fieldName'=>'parent'
		),
		'type'=>array(
			'$fieldName'=>'type'
		),
		'count'=>array(
			'$fieldName'=>'count'
		),
		'comment_status'=>array(
			'$fieldName'=>'comment_status'
		),
		'comment_count'=>array(
			'$fieldName'=>'comment_count'
		)
	);
	
	function setDate($value){
		if(is_int($value)){
			return date('Y-m-d H:i:s',$value);;
		}else{
			return $value;
		}
	}
/**
 * 
CREATE TABLE IF NOT EXISTS `posts` (
  `id` bigint(20) unsigned NOT NULL auto_increment,
  `author` bigint(20) unsigned NOT NULL default '0' COMMENT '作者',
  `date` datetime NOT NULL default '0000-00-00 00:00:00',
  `title` text NOT NULL,
  `content` longtext NOT NULL,
  `excerpt` text NOT NULL,
  `status` varchar(20) NOT NULL default 'publish',
  `password` varchar(20) NOT NULL default '',
  `modified` datetime NOT NULL default '0000-00-00 00:00:00',
  `parent` bigint(20) unsigned NOT NULL default '0',
  `type` varchar(20) NOT NULL default 'post',
  `count` bigint(20) NOT NULL default '0',
  `comment_status` varchar(20) NOT NULL default 'open',
  `comment_count` bigint(20) NOT NULL default '0',
  PRIMARY KEY  (`id`),
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 * 
 */
}
